package com.itheima.domain;

public class Student1 implements Comparable<Student1> {
    private String name;
    private int age;

    public Student1() {
    }

    public Student1(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    @Override
    public String toString() {
        return "Student1{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }

    @Override
    public int compareTo(Student1 student1) {
       // return 1;
        int i = this.age - student1.age;
        int i1 = i == 0 ? this.name.compareTo(student1.name) : i;
        return i1;
    }
}
